#include<iostream>
#include<cmath>
#define maxn 10
using namespace std;
double f(int n,double a[],double x);
int main(){
	int n;
	double a[maxn];
	double x;
	cin>>n;cin>>x;
	for(int i=0;i<=n;i++){
		cin>>a[i];
	}
	cout<<f(n,a,x)<<endl;
	return 0;
} 
double f(int n,double a[],double x){
	double fx=0;
	for(int i=0;i<=n;i++){
		fx+=(a[i]*pow(x,i));
	}
	return fx;
}
